package io.zsy.jdbc.dao;

import io.zsy.jdbc.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

/**
 * @author zhangshuaiyin
 * @date 2022/4/25 21:50
 */
@Repository
public class StudentDaoImpl implements StudentDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void add(Student student) {
        String sql = "insert into student values(?, ?, ?, ?)";

        // 修改、删除、查询、计数(count) 略
        int update = jdbcTemplate.update(sql, student.getSid(), student.getSname(), student.getSage(), student.getSsex());
        System.out.println(update);
    }
}
